package y2015.day_08.工具方法;

public class Unit {
    public static byte[] intToBytes(int i) {
        byte[] a = new byte[4];
        a[0] = (byte) (i >> 24);
        a[1] = (byte) (i >> 16);
        a[2] = (byte) (i >> 8);
        a[3] = (byte) (i >> 0);
        return a;
    }

    public static int bytesToInt(byte[] a) {
        int i = 0;
        i |= a[0] << 24 >> 0;
        i |= a[1] << 24 >> 8;
        i |= a[2] << 24 >> 16;
        i |= a[3] << 24 >> 24;
        return i;

    }
}

